<template>
    <div>
        <eagle-page-list ref="eaglePageList" @bindData="bindData" :queryParams="queryParams" :controller="controller" :conditions="conditions" :pageSize="20">
            <div slot="search">
                <van-sticky :offset-top="45">
                    <eagle-search @search="search" placeholder="请输入关键字" v-model="searchValue">
                    </eagle-search>
                </van-sticky>
            </div>
            <div slot="list">
                <van-cell class="card" v-for="(item, index) in list" :key="index">
                <van-tag
                    v-if="item.Status === 10 && !item.IsExpire"
                    class="info_tag"
                    color="#1989fa"
                    >进行中</van-tag
                >
                <van-tag
                    v-if="item.Status === 10 && item.IsExpire"
                    class="info_tag"
                    type="danger"
                    >已过期</van-tag
                >
                <div class="warn_item">
                    <div @click="goDetail(item)">
                    <van-row>
                        <van-col span="24">
                        {{ index + 1 }}、{{ item.CheckTaskName }}</van-col
                        >
                    </van-row>
                    <van-row gutter="20" class="dep_sort">
                        <van-col span="12">
                        <img
                            src="@/assets/Images/AppIcon/icon_list_type.png"
                            alt=""
                        />{{ item.CheckTypeName }}</van-col
                        >
                        <van-col span="12">
                        <img
                            src="@/assets/Images/AppIcon/icon_list_danger.png"
                            alt=""
                        />隐患/检查：{{ item.HiddenDangerCnt }}/{{
                            item.CheckCnt
                        }}</van-col
                        >
                    </van-row>

                    <van-row gutter="20" class="dep_sort">
                        <van-col span="12">
                        <img
                            src="@/assets/Images/AppIcon/icon_list_user.png"
                            alt=""
                        />{{ item.CreateChnName }}
                        </van-col>
                    </van-row>

                    <van-row gutter="20" class="dep_sort">
                        <van-col span="24">
                        <img
                            src="@/assets/Images/AppIcon/icon_list_date.png"
                            alt=""
                        />{{ item.StartDate | formatDate }}至{{
                            item.EndDate | formatDate
                        }}</van-col
                        >
                    </van-row>
                    </div>
                </div>
                </van-cell>
                <!-- <van-cell class="card" v-for="(item, index) in list" :key="index">
                    <div>
                        <div>
                        <div class="title">
                            <div>{{ item.AccidentConsequence }}</div>
                        </div>
                        <van-row gutter="20">
                            <van-col>
                            <img
                                class="icon"
                                src="@/assets/Images/AppIcon/icon_list_date.png"
                            />事故日期：{{ item.AccidentDate | formatDate }}
                            </van-col>
                        </van-row>
                        <van-row gutter="20">
                            <van-col>
                            <img
                                class="icon"
                                src="@/assets/Images/AppIcon/icon_list_date.png"
                            />年份：{{ item.Key }}
                            </van-col>
                        </van-row>
                        <van-row gutter="20">
                            <van-col>
                            <img
                                class="icon"
                                src="@/assets/Images/AppIcon/icon_list_user.png"
                            />录入人：{{ item.CreateChName }}
                            </van-col>
                        </van-row>
                        <van-row gutter="20">
                            <van-col>
                            <img
                                class="icon"
                                src="@/assets/Images/AppIcon/icon_list_date.png"
                            />录入时间：{{ item.CreateDate | formatDate }}
                            </van-col>
                        </van-row>
                        <van-divider />
                        <div class="op_btn">
                            <div class="btn_item" @click="edit(item)">
                            <img
                                src="@/assets/Images/AppIcon/icon_list_edit.png"
                                alt=""
                            />
                            <div class="mr-10">编辑</div>
                            </div>
                        </div>
                        </div>
                    </div>
                </van-cell> -->
            </div>
		</eagle-page-list>
    </div>
</template>
<script>

export default {
    data(){
        return {
            list:[],
            searchValue:'',
            // 查询条件判断方式 : like,<,>,<=,>=,= ,
            // 查询条件
            //示例：hiddenDangerTypeCode: { value: "", options: "=" },
            conditions: {},
            controller:"/DangerCheckTask",
            queryParams: {
                dataType:"NotFinish",
                keywords:"",
			},
        }
    },
    created(){
        
    },
    mounted() {
        //this.queryPage();
    },
    methods:{
        search(conditions){
            this.queryPage();
        },
        queryPage() {	
            
            let _this = this;
            if(this.searchValue && this.searchValue!=''){
                this.queryParams.keywords = searchValue;
            }
            _this.$refs.eaglePageList.search();
        },
        bindData(data){
            this.list=[];
            if(data){
                this.list = data;
            }
        },
        goDetail(item) {
            this.$router.push({
                path: "/Danger/DangerCheckTaskEdit",
                query: { id: item.ID },
            });
        },
    }
}
</script>
<style lang="less" scoped>
.dep_sort {
  // display: flex;
  // flex-wrap: wrap;
  // margin-bottom: 5px;
  img {
    height: 15px;
    width: 15px;
    margin-right: 5px;
  }
}
</style>

